from testing.flow import TestFlow

t = TestFlow('Test the TestFlow')

@t.start
def start(flow):
  flow.msg('You should see this msg only at the beginning')

@t.finish
def something(flow):
  flow.msg('You should this msg only at the end')

@t.setup
def setup(flow):
  flow.msg('You should see this msg before every block')

@t.teardown
def teardown(flow):
  flow.msg('You should see this msg after every block')

def mod2(x):
  return x%2
  
@t.checks(mod2, 4)
def test_stuff(flow, ret):
  flow.check(ret, "This should fail but there should be more tests afterwards")
  return True

@t.checks(mod2, 3)
def mod2(flow, ret):
  """ You should see this message before the second block """
  flow.check(ret, "This should pass")
  flow.check(False, "This should fail")
  flow.msg("There should be a traceback somewhere after this message")
  return False
